package de.jmda.sample.mproc.task;

import static de.jmda.core.util.CollectionsUtil.asSet;

import java.io.IOException;
import java.util.Set;

import javax.lang.model.element.TypeElement;

import org.junit.Test;

import de.jmda.core.mproc.task.AbstractTypeElementsTaskTypes;
import de.jmda.core.mproc.task.TaskException;
import de.jmda.core.mproc.task.TaskRunner;

public class JUTHelloWorldTypeElementsTask
{
	private class SampleTask extends AbstractTypeElementsTaskTypes
	{
		private SampleTask(Set<? extends Class<?>> types)
		{
			super(types);
		}

		@Override
		public boolean execute() throws TaskException
		{
			System.out.println("Hello World!");

			for (TypeElement type : getTypeElements())
			{
				System.out.println("Welcome " + type.getQualifiedName() + ".");
			}

			return false;
		}
	}

	@Test
	public void test() throws IOException
	{
		SampleTask task = new SampleTask(asSet(String.class));

		TaskRunner.run(task);
	}
}